//
//  UIView+CNViewController.m
//  BeeQuick_19
//
//  Created by 刘家强 on 16/9/24.
//  Copyright © 2016年 CN Team. All rights reserved.
//

#import "UIView+CNViewController.h"

@implementation UIView (CNViewController)

// 递归寻找数据
- (UIViewController *)viewController {
    for (UIView *next = [self superview]; next; next = next.superview) {
        
        // 响应这链条
        UIResponder *nextResponder = [next nextResponder];
        if ([nextResponder isKindOfClass:[UIViewController class]]) {
            return (UIViewController*)nextResponder;
        }
    }
    return nil;
}

@end
